{extend name="public:layout" /}
{block name="title"}客户结算{/block}
{block name="head"}{/block}
{block name="body"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox">
        <div class="ibox-title">
            <ol class="breadcrumb">
                <li><i class="fa fa-hand-o-right"></i> 客户结算</li>
            </ol>
        </div>
        <div class="ibox-content">
            <div class="toolbar">
                <form class="form-inline" method="post">
                    <div class="form-group">
                        <input class="form-control" name="rangdate" id="rangdate" type="text" value="{$rangdate}" placeholder="日期范围">
                    </div>
                    <div class="form-group">
                        <select name="order_q" class="form-control">
                            <option value="1" {eq name="order_q" value="1"}selected{/eq}>欠款用户</option>
                            <option value="0" {eq name="order_q" value="0"}selected{/eq}>已结清用户</option>
                        </select>
                    </div>
					<div class="form-group">
                        <select name="is_gua" class="form-control">
                                <option value="0" {eq name="is_gua" value="0"}selected{/eq}>全部客户</option>
                                <option value="1" {eq name="is_gua" value="1"}selected{/eq}>超出挂账客户</option>
                                <option value="2" {eq name="is_gua" value="2"}selected{/eq}>正常客户</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <input class="form-control" name="customer" type="text" value="" placeholder="请输入客户名称">
                    </div>
                    <button type="submit" class="btn btn-info">
                        <i class="fa fa-search"></i> 搜索
                    </button>
                    <a href="/system/logic.order/paymoney.html">全部欠款</a>
                </form>
            </div>
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th>客户姓名</th>
                    <th>联系电话</th>
                    <th>所属单位</th>
                    <th>订单总额</th>
                    <th>挂账额度</th>
                    <th>订单欠款</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                {volist name="list" id="vo"}
                <tr>
                    <td>{$vo.btype.title}</td>
                    <td>{$vo.btype.btype_phone}</td>
                    <td>{$vo.btype.company}</td>
                    <td>{$vo.sum_order_charge}</td>
                    <td>{$vo.btype.credit_line}</td>
                    <td>{$vo.sum_order_q}</td>
                    <td>
                        {if $order_q==1}
                        <a href="/system/logic.order/dopaymoney.html?btype_id={$vo.btype_id}&rangdate={$rangdate}">结算</a>
                        {/if}
                        {if $order_q==0}
                        <a href="/system/logic.order/dopaymoney.html?btype_id={$vo.btype_id}&rangdate={$rangdate}&order_q=0&tpl=viewpaymoney">查看</a>
                        {/if}
                    </td>
                </tr>
                {/volist}
                </tbody>
                <tfoot>
                <tr>
                    <td colspan="7">合计：当前订单总额:{$sum.sum_order_charge}元，欠款总额：{$sum.sum_order_q}元</td>
                </tr>
                </tfoot>
            </table>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script>
    $(function () {
        $('[data-toggle="tooltip"]').tooltip()
    });
    In('laydate',function () {
        laydate.render({
            elem: '#rangdate',
            range: '~'
        });
    })
</script>
{/block}